package com.multi.tool.collection;

import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.ListUtils;
import org.apache.commons.lang3.tuple.ImmutablePair;
import org.apache.commons.lang3.tuple.ImmutableTriple;
import org.apache.commons.lang3.tuple.Pair;

import java.util.Arrays;
import java.util.List;

public class CollectionDemoTest {

    public static void main(String[] args) {
        List<Integer> list1 = Arrays.asList(1, 2, 4);
        List<Integer> list2 = Arrays.asList(1, 4, 2);

        // 判断集合相等
        System.out.println(CollectionUtils.isEqualCollection(list1, list2));
        // 严格校验集合元素的顺序
        System.out.println(ListUtils.isEqualList(list1, list2));
        System.out.println();

        Pair<Integer, Integer> pair = new ImmutablePair<>(1, 3);
        System.out.println("left=" + pair.getLeft() + ",right=" + pair.getRight());
        System.out.println("key=" + pair.getKey() + ",value=" + pair.getValue());
        System.out.println();

        ImmutableTriple<Integer, Integer, Integer> triple = new ImmutableTriple<>(1, 2, 3);
        System.out.println(triple.getLeft() + "," + triple.getMiddle() + "," + triple.getRight());

    }
}
